#include "SDL/SDL.h"
#include "state.h"
#include "constants.h"
#include <iostream>
using namespace std;

//Globals
SDL_Surface *screen;

//Constants from constants.h
extern const int SCREEN_WIDTH;
extern const int SCREEN_HEIGHT;
extern const int SCREEN_BPP;
extern const int FRAMES_PER_SECOND;

bool init_sdl();

int main(int argc, char* args[])
{
	if(!init_sdl())
	{
		//SDL Failed to initialize
		cout << "SDL Failed to initialize!" << endl;
		return 1;
	}

	State *a = new TitleScreen;
	delete a;

	SDL_Quit();
	return 0;
}

bool init_sdl()
{
	/*Initialize all SDL subsystems
	 *
	 */
	if(SDL_Init(SDL_INIT_EVERYTHING) == -1)
	{
		return false;
	}

	//Set up the screen
	screen = SDL_SetVideoMode(SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_BPP, SDL_SWSURFACE);

	//If there was an error in setting up the screen
	if(screen == NULL)
	{
		return false;
	}

	//Set the window caption
	SDL_WM_SetCaption("Ship Shootem'Up!", NULL);
	return true;
}
